﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="volva.Models" %>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h1>Skilaboð</h1> <br />
    
    <%=Html.ActionLink("Skrifa ný skilaboð", "WriteMessage") %> <br />
    
    
            <table width="500px">
            <tr>
                <th>Nýtt</th>
                <th>Frá</th>
                <th>Titill</th>
            </tr>
            <%
        foreach (Message m in ViewData["Messages"] as List<Message>)
        {
            string fromUserName = m.WebUserFrom.username;
            string userAction = "Profile/" + m.WebUserFrom.id.ToString();
            string messageAction = "ViewMessage/" + m.id;
            
            %>

            <tr>
                <% 
                    if (m.isNew == true)
                    {
                        Response.Write("<td class=\"unread\">&nbsp;</td>");
                    }
                    else
                    {
                        Response.Write("<td>&nbsp;</td");
                    }
                     %>
                <td><%= Html.ActionLink(fromUserName, userAction) %></td>
                <td><%= Html.ActionLink(m.subject, messageAction) %></td>
            </tr><%
        }
         %>
          </table>

</asp:Content>
